
import com.Lyy.UL.ICO;
import com.Lyy.controller.StudentC;
import com.Lyy.enity.Student;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import java.sql.SQLException;


public class StudentT {
    @Test
    public void SelectStudent() throws SQLException {
        int id = 2;
        ApplicationContext applicationContext = (new ICO()).ico("student.xml");
        StudentC dataSourceC = applicationContext.getBean(StudentC.class);
        Student student = dataSourceC.getStudentByID(id);
        System.out.println("studebt = " + student);

    }
    @Test
    public void DeleStudent(){
        int id = 2;
        ApplicationContext applicationContext = (new ICO()).ico("student.xml");
        StudentC dataSourceC = applicationContext.getBean(StudentC.class);
        String s = dataSourceC.deleteById(id);
        System.out.println(s);
    }
    @Test
    public void addStudent(){
        Student student = new Student(8, "text8");
        ApplicationContext applicationContext = (new ICO()).ico("student.xml");
        StudentC dataSourceC = applicationContext.getBean(StudentC.class);
        String s = dataSourceC.addStudent(student);
        System.out.println(s);
    }
    @Test
    public void updateStudent(){
        Student student = new Student(6, "text66");
        ApplicationContext applicationContext = (new ICO()).ico("student.xml");
        StudentC dataSourceC = applicationContext.getBean(StudentC.class);
        String s = dataSourceC.updateStudent(student);
        System.out.println(s);
    }

}
